(define-module (utils from-git)
  #:use-module (gnu)
  #:use-module (guix git-download)
  #:use-module (guix packages)
  #:use-module (guix)
  #:export (from-git))

(define (from-git pkg remote commit revision hash)
  (package
    (inherit pkg)
    (name (string-append (package-name pkg) ".git"))
    (version (git-version (package-version pkg) revision commit))
    (source
       (origin
	 (method git-fetch)
	 (uri (git-reference
	       (url remote)
               (commit commit)))
         (file-name (string-append name "-" version))
	 (sha256 (base32 hash))))))

